<!DOCTYPE html>
<html>
<head>
    <include file="public/public_css" />
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <include file="public/header-min" />
    <!-- Left side column. contains the logo and sidebar -->
    <include file="public/left" />
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                留言管理
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li class="active">内容管理</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <!-- Small boxes (Stat box) -->
            <!-- Small boxes (Stat box) -->
            <div class="row">
                <table id="menuList" class="table table-hover">
                    <tr>
                        <th>id</th>
                        <th>留言人</th>
                        <th>留言内容</th>
                        <th>留言时间</th>
                        <th>操作</th>
                    </tr>
                    <volist name="list" id="vo">
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.name}</td>
                            <td>{$vo.content}</td>
                            <td>{:date('Y-m-d H:i', $vo.add_time)}</td>
                            <td>
                                <a class="delArticle" data-id="{$vo.id}" href="javascript:void(0);" >
                                    <button type="button" class="btn btn-danger">删除</button>
                                </a>
                            </td>
                        </tr>
                    </volist>
                </table>
                <div>
                    {$list->render()}
                </div>
            </div>


        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <include file="public/footer" />

    <!-- Control Sidebar -->

    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<include file="public/public_js" />

<script>


    //删除留言
    $('.delArticle').click(function(){
        var id = $(this).data("id");
        layer.open({
            btn: ['删除', '取消'],
            yes: function(){
                $.ajax({
                    type : 'POST', //GET,POST
                    url: '{$Think.WEB_PATH}/Admin/Message/delMessage?id='+ id,
                    dataType : 'json', //xml,json,script，默认为null
                    success : function (data) {
                        layer.open({
                            type: 1,
                            time: 5000,
                            area: ['200px', '200px'],
                            content: data.msg //服务器返回的消息
                        });
                        setTimeout(function(){
                            window.location.reload();
                        },1200);
                    },
                    error : function (event, errorText, errorType) { //错误时调用
                        alert(errorText + errorType);
                    }
                })
            },
            no: function(){

            },
            fixed: false, //不固定
            maxmin: true,
            content:'确定要删除吗？'
        });
    });

</script>
</body>
</html>
